package org.example.petitionplatformsystem;

import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
public class Response <T>{
    private T data;
    private int code;
    private String desc;

    public static <K>Response<K> newSuccessResponse(K data){
        Response<K> response = new Response<>();
        response.setData(data);
        response.setCode(0);
        response.setDesc("success");
        return response;

    }


    public static <K>Response<K> newFailResponse(String desc){
        Response<K> response = new Response<>();
        response.setCode(1);
        response.setDesc(desc);
        return response;

    }
    public static <K>Response<K> newSuccessResponse(K data,String desc){
        Response<K> response = new Response<>();
        response.setData(data);
        response.setCode(0);
        response.setDesc(desc);
        return response;

    }

}
